<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="public/js/jquery-1.10.2.js"></script>
    <script type="text/javascript">
//        $(function () {
//            var arr = ['11','22','33',124];
//            var res = $.inArray('124', arr);
//            console.log(res);
//        });

        $(function () {
            $('#btn').on('click', function () {
//                console.log();
//                var select = '#nav option[value='+1+']';
//                $(select).attr('selected', true);
//                console.log(select);

//                $('#nav option[class=c1]').attr('selected', true);

                var str = '哈哈1,哈哈2,哈哈4';
                var arr = str.split(',');
                console.log(arr);
                $('#cb input').each(function (index, val) {
                    var val = $(this).val();
                    if ($.inArray( val,  arr ) >= 0){
                        $(this).attr('checked', true);
                    }
                });

            });

        });
    </script>
</head>
<body>
<select name="nav" id="nav" class="nav">
    <option value="0" class="c0">哈哈1</option>
    <option value="1" class="c1">哈哈2</option>
    <option value="2" class="c2">哈哈3</option>
    <option value="3" class="c3">哈哈4</option>
    <option value="4" class="c4">哈哈5</option>
</select>

<button id="btn">选择</button>

<div id="cb">
    <input type="checkbox"  value="哈哈1" />
    <input type="checkbox"  value="哈哈2" />
    <input type="checkbox"  value="哈哈3" />
    <input type="checkbox"  value="哈哈4" />
</div>


</body>
</html>